package com.jsmile.cloud.tradecenter.express;

import java.util.List;
import java.util.stream.Collectors;

import org.springframework.stereotype.Service;

import com.jsmile.cloud.tradecenter.api.req.express.ReqExpressQuery;
import com.jsmile.cloud.tradecenter.api.res.express.ResExpressCompany;
import com.jsmile.cloud.tradecenter.express.repo.ExpressCompanySearchRepository;

import cn.hutool.core.bean.BeanUtil;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;

@Slf4j
@Service
@AllArgsConstructor
public class ExpressCompanyApplicationService {

    private final ExpressCompanySearchRepository expressCompanySearchRepository;

    public List<ResExpressCompany> findAll(ReqExpressQuery reqExpressQuery) {
        return expressCompanySearchRepository.findAll(reqExpressQuery).stream().map(x -> BeanUtil.toBean(x, ResExpressCompany.class)).collect(Collectors.toList());
    }

}
